#!/usr/local/bin/lua
--
--	Chapter 03	-	Arithmetic Operator
--
--	Michael Ge
--	2014.05.17
--

print("====================")

a = 3
b = 5
print((a % b) == (a - math.floor(a / b) * b))

x = math.pi
print(x - x % 0.01)

print("====================")

local tolerance = 10

function isturnback(angle)
	angle = angle % 360
	return (math.abs(angle - 180) < tolerance)
end

print(isturnback(-180))

print("====================")

tolerance = 0.17

function isturnback2(angle)
	angle = angle % (2 * math.pi)
	return (math.abs(angle - math.pi) < tolerance)
end

print(isturnback2(-math.pi))

print("====================")